package com.hxzy.controller.admin.contamer;

import com.github.pagehelper.PageInfo;
import com.hxzy.common.vo.resp.PageResp;
import com.hxzy.common.vo.resp.R;
import com.hxzy.controller.admin.contamer.req.ContamerReq;
import com.hxzy.controller.admin.contamer.resp.ContamerResp;
import com.hxzy.controller.admin.mapstruct.ContamerConvert;
import com.hxzy.entity.Contamer;
import com.hxzy.service.ContamerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @Desc 描述
 * @Author: admin
 * @Date: 2023/06/30/16:23
 */
@Api(tags = "管理后台-前端用户列表")
@RestController
@RequestMapping(value = "/api/contamer")
public class ContamerController {

    @Autowired
    private ContamerService contamerService;

    @ApiOperation(value = "分页查询")
    @GetMapping(value = "/data")
    public R<PageResp<ContamerResp>> search(@Valid ContamerReq req) {
        PageInfo<Contamer> pageInfo=this.contamerService.search(req);

        PageResp<ContamerResp>  resp=new PageResp<>();
        resp.setTotal(pageInfo.getTotal());
        resp.setRows(ContamerConvert.INSTANCE.convert(pageInfo.getList()));

        return R.okHasData(resp);
    }


}
